home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Jun 90 / MacApp.Tech$ 6⁄22⁄90 / 1477-CatchFailures and Me-Jun90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.7 KB  |  58 lines  |  [TEXT/GEOL]

  1. Item    4707440                         21-June-90        16:28PDT
  2.  
  3. From:   VANPATTEN                       Van Patten, Don
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. cc:     VANPATTEN                       Van Patten, Don
  8.  
  9. Sub:    CatchFailures and Methods
  10.  
  11. I am new to C++ and would like to use the error trapping mechanisms available
  12. with MacApp.  I want to make the error handler I am using part of an object.
  13. However, I get the error described below when I try to pass the method in the
  14. same way I would if it were a standard pascal void (*).  I would appreciate
  15. being educated in this area.
  16.  
  17. My situation is described below:
  18.  
  19. As defined in "UFailure.h":
  20.    CatchFailures (FailInfo *fi,
  21.    pascal void (*Handler)(short e, long m, void* Handler_StaticLink),
  22.    void *Handler_StaticLink);
  23.  
  24. Declaration of method in my object:
  25.    public:
  26.    pascal virtual void StandardErrorHandler (short error_num,
  27.    long error_message,
  28.    void* Handler_StaticLink);
  29.  
  30. Definition of method:
  31.    pascal void TErrorManager::StandardErrorHandler (short error_num,
  32.    long error_message,
  33.    void* Handler_StaticLink)
  34.    {
  35.    /* code */
  36.    }
  37.  
  38. Attempted use of method as a parameter:
  39.    CatchFailures (&fail_info,
  40.    &(gErrorManager->StandardErrorHandler),
  41.    errorBuf);
  42.  
  43. Compiler offense:
  44.    # warning: address of bound function
  45.    (try using ``TErrorManager ::*'' for pointer type
  46.    and ``&TErrorManager ::StandardErrorHandler '' for address)
  47.  
  48.    # error: bad argument  2 type for CatchFailures():
  49.    pascal void (TErrorManager:: *)(short , long , void *)
  50.    ( pascal void (*)(short , long , void *) expected)
  51.  
  52. I have tried the suggestion given by the warning and even attempted to cast the
  53. parameter but have been unsuccessful.
  54.  
  55. Thanks in advance,
  56. Don Van Patten
  57.  
  58.